package com.dianping.cat.home.storage.transform;

import com.dianping.cat.home.storage.entity.Link;
import com.dianping.cat.home.storage.entity.Storage;
import com.dianping.cat.home.storage.entity.StorageGroup;
import com.dianping.cat.home.storage.entity.StorageGroupConfig;
import org.xml.sax.Attributes;







public class DefaultSaxMaker
  extends Object
  implements IMaker<Attributes>
{
  public Link buildLink(Attributes attributes) {
/* 20 */     String url = attributes.getValue("url");
/* 21 */     Link link = new Link();

/* 23 */     if (url != null) {
/* 24 */       link.setUrl(url);
    }

/* 27 */     return link;
  }



/* 32 */   public String buildPar(Attributes attributes) { throw new UnsupportedOperationException(); }



  public Storage buildStorage(Attributes attributes) {
/* 37 */     String id = attributes.getValue("id");
/* 38 */     String department = attributes.getValue("department");
/* 39 */     String productline = attributes.getValue("productline");
/* 40 */     String title = attributes.getValue("title");
/* 41 */     Storage storage = new Storage(id);

/* 43 */     if (department != null) {
/* 44 */       storage.setDepartment(department);
    }

/* 47 */     if (productline != null) {
/* 48 */       storage.setProductline(productline);
    }

/* 51 */     if (title != null) {
/* 52 */       storage.setTitle(title);
    }

/* 55 */     return storage;
  }


  public StorageGroup buildStorageGroup(Attributes attributes) {
/* 60 */     String id = attributes.getValue("id");
/* 61 */     return new StorageGroup(id);
  }





/* 68 */   public StorageGroupConfig buildStorageGroupConfig(Attributes attributes) { return new StorageGroupConfig(); }





  protected <T> T convert(Class<T> type, String value, T defaultValue) {
/* 75 */     if (value == null || value.length() == 0) {
/* 76 */       return defaultValue;
    }

/* 79 */     if (type == Boolean.class || type == boolean.class)
/* 80 */       return (T)Boolean.valueOf(value); 
/* 81 */     if (type == Integer.class || type == int.class)
/* 82 */       return (T)Integer.valueOf(value); 
/* 83 */     if (type == Long.class || type == long.class)
/* 84 */       return (T)Long.valueOf(value); 
/* 85 */     if (type == Short.class || type == short.class)
/* 86 */       return (T)Short.valueOf(value); 
/* 87 */     if (type == Float.class || type == float.class)
/* 88 */       return (T)Float.valueOf(value); 
/* 89 */     if (type == Double.class || type == double.class)
/* 90 */       return (T)Double.valueOf(value); 
/* 91 */     if (type == Byte.class || type == byte.class)
/* 92 */       return (T)Byte.valueOf(value); 
/* 93 */     if (type == Character.class || type == char.class) {
/* 94 */       return (T)Character.valueOf(value.charAt(0));
    }
/* 96 */     return (T)value;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/storage/transform/DefaultSaxMaker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */